
cc.Class({
    extends: cc.Component,

    properties: {
        className:"popuplayer",
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad: function () {
        this.node.thisJS = this;
        this.soundlayer =  cc.find("soundlayer",this.node);
        this.roomrulelayer = cc.find("roomrulelayer",this.node);
        this.chatlayer = cc.find("chatlayer",this.node);
        this.tipslayer = cc.find("tipslayer",this.node);
        this.homelayer = cc.find("homelayer",this.node);
        this.initUI();
    },
    start: function () {
       
    },
    initUI: function(){
        EventManager.addEventObeserveF(EventConfig.soundClick, handler(this,
            this.soundClick),"popuplayer");    
        EventManager.addEventObeserveF(EventConfig.ruleClick, handler(this,
            this.ruleClick),"popuplayer");   
        EventManager.addEventObeserveF(EventConfig.showRoomInfo, handler(this,
            this.showRoomInfo),"popuplayer");   
        EventManager.addEventObeserveF(EventConfig.tipsClick, handler(this,
            this.tipsClick),"popuplayer");  
        EventManager.addEventObeserveF(EventConfig.homeClick, handler(this,
            this.homeClick),"popuplayer");  
        
    },
    soundClick:function(){
        if (this.soundlayer.active){
            this.soundlayer.active = false ;
        }else{
            this.soundlayer.active = true ;
        }
    },
    ruleClick:function(){
        if (this.roomrulelayer.active){
            this.roomrulelayer.active = false ;
        }else{
            this.roomrulelayer.active = true ;
            this.roomrulelayer.thisJS.updateView(this.showRoomInfo);
        }
    },
    showRoomInfo:function(info){
        this.showRoomInfo = info ;
    },

    tipsClick:function(){
        if (this.tipslayer.active){
            this.tipslayer.active = false ;
        }else{
            this.tipslayer.active = true ;
        }
    },
    homeClick:function(){
        if (this.homelayer.active){
            this.homelayer.active = false ;
        }else{
            this.homelayer.active = true ;
        }
    },

});